package com.faxe.educar.ws.daohibernate;

import java.util.List;

import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;

import com.faxe.educar.ws.dao.UserDAO;
import com.faxe.educar.ws.to.ServiceTO;
import com.faxe.educar.ws.to.UserTO;

@Repository
public class UserDAOHibernate extends GenericDAOHibernate<UserTO> implements UserDAO {
	
	

	public List<UserTO> getUserList() {
		List<UserTO> users = null;
		return users;
	}
	
	public UserTO getUserByEmail(String email){
		
		String sqlStr = "SELECT * FROM USERS WHERE email = '"+email+"'";
		
		UserTO user = (UserTO) getSession().createSQLQuery(sqlStr).addEntity(UserTO.class).uniqueResult();
		
		return user;
	}

}
